﻿using System.Drawing;
using System.Workflow.ComponentModel;
using System.Workflow.ComponentModel.Design;

namespace WorkflowLibrary
{
	class DisplayPageActivityDesigner : ActivityDesigner
	{
        DisplayPageActivity _activity;
        protected override void Initialize(Activity activity)
        {
            _activity = activity as DisplayPageActivity;
            base.Initialize(activity);
        }
        protected override Size OnLayoutSize(ActivityDesignerLayoutEventArgs e)
        {
            return new Size(320, 50);
        }

        protected override void OnPaint(ActivityDesignerPaintEventArgs e)
        {
            e.Graphics.FillRectangle(Brushes.CornflowerBlue,
            Location.X, Location.Y,
            Size.Width, Size.Height);
            StringFormat format = new StringFormat();
	     
            format.Alignment = StringAlignment.Center;
            Rectangle rect = new Rectangle(Location.X, Location.Y,
            Size.Width, 15);
            e.Graphics.DrawString(Activity.QualifiedName,
            DesignerTheme.Font,
            Brushes.Yellow, rect, format);
            using(Font font = new Font("Lucida Console", 8))
            {
                e.Graphics.DrawString("Page Guid: "+_activity.PageGuid, font,
                Brushes.White, rect.X, rect.Y + 20);
            }
        }
    }
}
